{% extends ../master.html %}

{% block head %}
    <link rel="stylesheet" href="/static/css/table.css"/>

    <style type="text/css">
        .barcode {
            /*float: left;*/
        }

        .main-sys-info {

        }
    </style>
{% end %}

{% block body %}
<script type="text/javascript" src="/static/lib/datejs/date.min.js"></script>
<script type="text/javascript" src="/static/lib/string-format/string-format.min.js"></script>
<script type="text/javascript" src="/static/lib/jquery.qrcode/jquery.qrcode.min.js"></script>

<input class="hide" id="server_ip" value="{{?server_ip}}" />
<input class="hide" id="server_port" value="{{?port}}"/>
<div class="row">
    <div class="barcode col-md-12">
        <p>{{?ip_list}} : 端口{{?port}}</p>
        <p>扫码登录 {{?server_ip}}:{{?port}}</p>
        <div id="qrcode"></div>
    </div>

    <div style="float:left;width:100%; height:30px"></div>

    <div>
        <a href="/system/reload">重新加载模块</a>
    </div>

    <div style="float:left;width:100%; height:30px"></div>

</div>

<script type="text/javascript">
$("#menu-sys").addClass("active");

$(function () {
    var ip = $("#server_ip").val()
    var port = $("#server_port").val()
    // var url = format("http://{}:{}", ip, port);
    var url = "http://" + ip + ":" + port;
    $("#qrcode").qrcode(url);
    function updateTime () {
        $("#currentDate").html(new Date().toString("yyyy-MM-dd HH:mm:ss"));
        setTimeout(updateTime, 1000);
    }

    updateTime();

    $("#rebackup").click(function () {
        $.post("/system/sys?option=backup", {}, function (data) {
            var r = JSON.parse(data);
            if (r.success) {
                // alert("备份完成");
                window.location.reload();
            } else {
                alert(format("备份失败, 原因: {}", r.msg));
            }
        });
    })

    $("#export").click(function () {
        $.post("/system/sys?option=export", {}, function (data) {
            var r = JSON.parse(data);
            if (r.success) {
                window.location.reload();
            } else {
                alert(format("备份失败, 原因: {}", r.msg));
            }
        });
    });
})



</script>
{% end %}